<?php
namespace App\Http\Controllers;

use App\Models\Activity;
use Illuminate\Support\Facades\Schema;

class ActivityController extends WxBaseController{
    protected $except=['index','show'];
    public function index($num=10){
        $acs = Activity::orderBy('created_at','desc')->simplePaginate($num);
        editImageUrl($acs);
        return $this->apiReturn(true,'success',$acs);
    }
    public function show($id){
        $ac = Activity::where('id',$id);
        //更新浏览量
        if(Schema::hasColumn('activitys', 'watch')){
            $ac->increment('watch');
        };
        $arr = $ac->get();
        editImageUrl($arr);
        return $this->apiReturn(true,'success',$arr);
    }
}